/*    */ package tools.packet;
/*    */ 
/*    */ import client.MapleClient;
/*    */ import client.inventory.Item;
/*    */ import handling.opcode.SendPacketOpcode;
/*    */ import org.apache.logging.log4j.LogManager;
/*    */ import org.apache.logging.log4j.Logger;
/*    */ import tools.DateUtil;
/*    */ import tools.data.output.MaplePacketLittleEndianWriter;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class ChatPacket
/*    */ {
/* 18 */   private static final Logger log = LogManager.getLogger(ChatPacket.class);
/*    */   
/*    */   public static byte[] getChatLoginAUTH() {
/* 21 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/*    */     
/* 23 */     mplew.writeShort(SendPacketOpcode.SERVERLIST.getValue());
/* 24 */     mplew.write(0);
/*    */     
/* 26 */     return mplew.getPacket();
/*    */   }
/*    */   
/*    */   public static byte[] getChatLoginResult(MapleClient c) {
/* 30 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/*    */     
/* 32 */     mplew.writeShort(SendPacketOpcode.CHAT_SERVER_RESULT.getValue());
/* 33 */     mplew.write(0);
/* 34 */     mplew.writeInt(c.getAccID());
/*    */     
/* 36 */     return mplew.getPacket();
/*    */   }
/*    */   
/*    */   public static byte[] buddyChat(int fromaccid, int fromchrid, String chattext) {
/* 40 */     return buddyChat(false, fromaccid, fromchrid, chattext, null);
/*    */   }
/*    */   
/*    */   public static byte[] buddyChat(boolean itemBuddyChat, int fromaccid, int fromchrid, String chattext, Item item) {
/* 44 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/*    */     
/* 46 */     mplew.writeShort(SendPacketOpcode.BUDDY_CHAT.getValue());
/* 47 */     mplew.writeInt(fromaccid);
/* 48 */     mplew.writeInt(fromaccid);
/* 49 */     mplew.writeInt(fromchrid);
/* 50 */     mplew.writeLong(DateUtil.getFileTimestamp(System.currentTimeMillis()));
/* 51 */     mplew.writeMapleAsciiString(chattext);
/* 52 */     mplew.write(0);
/* 53 */     if (itemBuddyChat) {
/* 54 */       PacketHelper.addItemInfo(mplew, item);
/*    */     }
/*    */     
/* 57 */     return mplew.getPacket();
/*    */   }
/*    */   
/*    */   public static byte[] guildChat(int fromaccid, int fromguildid, int fromchrid, String chattext) {
/* 61 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
/*    */     
/* 63 */     mplew.writeShort(SendPacketOpcode.GUILD_CHAT.getValue());
/* 64 */     mplew.writeInt(fromaccid);
/* 65 */     mplew.writeInt(fromguildid);
/* 66 */     mplew.writeInt(fromaccid);
/* 67 */     mplew.writeInt(fromchrid);
/* 68 */     mplew.writeLong(DateUtil.getFileTimestamp(System.currentTimeMillis()));
/* 69 */     mplew.writeMapleAsciiString(chattext);
/* 70 */     mplew.write(0);
/*    */     
/* 72 */     return mplew.getPacket();
/*    */   }
/*    */ }


/* Location:              C:\PGX\Server.jar!\tools\packet\ChatPacket.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */